package com.qianyu.project.mapper.provider;

import org.apache.ibatis.jdbc.SQL;
import org.springframework.util.ObjectUtils;

import java.util.Map;

/**
 * @Author ww
 * @desc
 */
public class BuildListMaintainSubMapperProvider {

    public String List(Map<String,String> params){
        return new SQL(){
            {
              SELECT("p.id pid,project_name,b.* ");
              FROM("project_info p,build_list_maintain b");
              WHERE("b.p_id=p.id");
              if(!ObjectUtils.isEmpty(params.get("m_subject"))){
               WHERE("m_subject like '%"+params.get("m_subject")+"%'");
              }
                if(!ObjectUtils.isEmpty(params.get("maintainer"))){
                    WHERE("maintainer like '%"+params.get("maintainer")+"%'");
                }
            }
        }.toString();
    }
}
